package serveur;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TopicSubscriber;
import javax.naming.Context;

import sql.CallRawDB;

public abstract class Serveur implements Runnable {
	
	public CallRawDB database = null;
	
	public String            factoryName = "ConnectionFactory";
	public Context           context    = null;
	public ConnectionFactory factory    = null;
	public Connection        connection = null;
	public Session           session    = null;
	
	public static final String Q_ORDRES             = "Q_Ordres";
	public static final String Q_REP_ORDRES         = "Q_Rep_Ordres";
	public static final String Q_TRANSACTIONS       = "Q_Transactions";
	public static final String Q_REP_TRANSACTIONS   = "Q_Rep_Transactions";
	public static final String Q_REQUETES      	    = "Q_Requetes";
	public static final String Q_REPONSES      	    = "Q_Reponses";
	public static final String T_RECHERCHES      	= "T_Recherches";
	
	// destinations disponibles
	public Destination Q_Ordres           = null;
	public Destination Q_Rep_Ordres       = null;
	public Destination Q_Transactions     = null;
	public Destination Q_Rep_Transactions = null;
	public Destination Q_Requetes         = null;
	public Destination Q_Reponses         = null;
	public Destination T_Recherches       = null;
    
	// message producers and consumers
//	public MessageProducer sender_Q_Ordres             = null;
	public MessageProducer sender_Q_Transactions       = null;
	public MessageProducer sender_T_Recherches         = null;
	public MessageProducer sender_Q_Reponses           = null;
//	public MessageProducer sender_Q_Rep_Ordres         = null;
	public MessageProducer sender_Q_Requetes           = null;
	public MessageProducer sender_Q_Rep_Transactions   = null;
    
	public MessageConsumer receiver_Q_Reponses         = null;
//	public MessageConsumer receiver_Q_Rep_Ordres       = null;
	public MessageConsumer receiver_Q_Requetes         = null;
	public MessageConsumer receiver_Q_Rep_Transactions = null;
	public MessageConsumer receiver_Q_Transactions     = null;
//	public MessageConsumer receiver_Q_Ordres           = null;
	public MessageConsumer receiver_Q_Client           = null;
	
	public TopicSubscriber subscriber_T_Recherches1    = null;
	public TopicSubscriber subscriber_T_Recherches2    = null;
	public TopicSubscriber subscriber_T_Recherches3    = null;

	@Override
	public void run() {
		// stub
		System.out.println("Attention : Run de base de Serveur, pas de surcharge faite");
	}
	
	public void init() {
		// stub
		System.out.println("Attention : Init de base de Serveur, pas de surcharge faite");
	}

}
